#pragma once
#include "vector"
#include "queue"
template<class V,class E = double >
class PrimData{
public:
    PrimData() = default;
    PrimData(V node1 , V node2 ,E dist)
    {
        m_node1 = node1;
        m_node2 = node2;
        m_dist = dist;
    }
    V m_node1;
    V m_node2;
    E m_dist;

};

template<class V,class E = double >
class PrimCompareData {
public:
    bool operator()( PrimData<V,E> a, PrimData<V,E> b) {
        // 由于std::priority_queue是最大堆，我们需要反转比较以实现最小堆
        return a.m_dist > b.m_dist;
    }
};

template<class V,class E  = double >
class PrimPriorityQueue
{
    // 构造适合Prim算法的优先队列
public:
    PrimPriorityQueue()= default;

    void push(PrimData<V,E> data){que.push(data);}

    PrimData<V,E> top(){return que.top();}

    bool empty(){return que.empty();}
    void pop(){ que.pop();}

private:
    std::priority_queue<PrimData<V,E>,std::vector<PrimData<V,E>>,PrimCompareData<V,E>> que;
};